<template>
  <div class="dashboard-container">
     <div class="dashboard-container" style="float:left">
      <h1>学校统计</h1>
      <h1 style="text-align:center">{{schoolCount}}</h1>
    </div>
    <div class="dashboard-container" style="float:left">
      <h1>学院统计</h1>
      <h1 style="text-align:center">{{academyCount}}</h1>
    </div>
    <div class="dashboard-container" style="float:left">
      <h1>班级统计</h1>
      <h1 style="text-align:center">{{classsCount}}</h1>
    </div>
    <div class="dashboard-container" style="float:left">
      <h1>学生统计</h1>
      <h1 style="text-align:center">{{studentCount}}</h1>
    </div>
    <div class="dashboard-container" style="float:left">
      <h1>教师统计</h1>
      <h1 style="text-align:center">{{teacherCount}}</h1>
    </div>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
    name: 'Dashboard',
    computed: {
      ...mapGetters([
        'name'
      ])
    },
 
    data(){      
      return{
        schools:{},
        schoolCount:0
      }
    },
    data(){  
      return{
        academys:{},
        academyCount:0
      }
    },
    data(){
      return{
        classss:{},
        classsCount:0
      }
    },
     data(){
      return{
        student:{},
        studentCount:0
      }
    },
    data(){  
      return{
        teachers:{},
        teacherCount:0
      }
    },  
    mounted(){
      this.$http.get('/api/users/add').then(res => {
        console.log('this.panels', res)
       })
      this.$http.post('/api/student/get').then(stu => {
        this.students = stu;
        this.studentCount = this.students.length;
        console.log(this.studentCount);
       })
      this.$http.post('/api/school/get').then(sch => {
        this.schools = sch;
        this.schoolCount = this.schools.length;
        console.log(this.schoolCount);
      })
      this.$http.post('/api/academy/get').then(aca => {
        this.academys = aca;
        this.academyCount = this.academys.length;
        console.log(this.academyCount);
      })
      this.$http.post('/api/classs/get').then(cla => {
        this.classss = cla;
        this.classsCount = this.classss.length;
        console.log(this.classsCount);
      })
       this.$http.post('/api/student/get').then(res => {
        this.student = res;
        this.studentCount = this.student.length;
        console.log(this.studentCount);
      })
      this.$http.post('/api/teacher/get').then(tea => {
        this.teachers = tea;
        this.teacherCount = this.teachers.length;
        console.log(this.teacherCount);
      })
    }
  }

</script>

<style lang="scss" scoped>
  .dashboard {
    &-container {
      margin: 30px;
    }
    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }
</style>